package org.six11.ss.client;

import java.util.Map;

import org.six11.ss.shared.Message;
import org.six11.util.adt.MultiState;

/**
 * 
 * 
 * @author Gabe Johnson <johnsogg@cmu.edu>
 */
public class JoinRoomMessageHandler extends AWTMessageHandler {

  /**
   * @param state
   */
  public JoinRoomMessageHandler(MultiState state) {
    super(state);
  }

  /**
   * 
   */
  @SuppressWarnings("unchecked")
  @Override
  public void handleAWT(Message msg) {
    TextConsole text = getConsole();
    text.addStatus(msg.getParam("playerNick") + " has joined " + msg.getParam("roomName"));
    if (msg.getParam("roomName").equals("the Lobby")) {
      Map<String, CommandHandler> handlers = (Map<String, CommandHandler>) state
          .getValue(ClientStateNames.K_COMMAND_HANDLERS);
      handlers.get("list").handleCommand("");
    }
  }
}
